/*
 * @Author: mayufo
 * @Date: 2020-02-16 22:03:45
 * @LastEditTime : 2020-02-16 22:07:24
 * @Description: 
 * @FilePath: /node/05/code/crud-express/student.js
 */
var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost:27017/itcast')

var Schema = mongoose.Schema

var studentSchema = new Schema({
    name: {
        type: String,
        required: true
    },
    gender: {
        type: Number,
        enum: [0, 1],
        default: 0   // 默认 0
    },
    age: {
        type: Number
    },
    hobbies: {
        type: String
    }
})

// 导出
module.exports = mongoose.model('Student', studentSchema)